import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
	state: {
		showType: "room",
		floorValue: "",
		colorType: "category",
		showWalls: true,
		liveStream: "",
		showCamera: false,
		device: "",
		showSystem: "",
		flow: false,
		baseColor: localStorage.getItem("baseColor") || "#103c56"
	},
	mutations: {
		changeViewByCode (state, payload) {
			state.showType = payload.type;
			state.floorValue = payload.id;
		},
		changeColorType (state, payload) {
			state.colorType = payload;
		},
		changeWall (state, payload) {
			state.showWalls = payload;
		},
		updateLiveStream (state, payload) {
			state.liveStream = payload.split(",")[ 1 ];
		},
		findFloorAndCamera (state, payload) {
			state.floorValue = payload[ 0 ];
		},
		updateCameraStatus (state, payload) {
			state.showCamera = payload;
		},
		selectDevice (state, payload) {
			state.device = payload;
		},
		changeModule (state, payload) {
			state.showType = payload.type;
			state.floorValue = payload.floor;
		},
		changeSystem (state, payload) {
			state.showSystem = payload;
		},
		changeFlow (state, payload) {
			state.flow = payload;
		},
		findRoom (state, payload) {
			state.floorValue = payload.floor;
		},
		ShowEviromentofThewall (state, payload) {
		},
		OpenSpacepointinf (state, payload) {
		},
		changeBoolean (state, payload) {
		},
		changeBaseColor (state, payload) {
			state.baseColor = payload;
			localStorage.setItem("baseColor", payload);
		}
	},
	actions: {},
	modules: {}
});
